<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.lmpop.trade.ti_discountpolicy.Ti_discountpolicyInfo"%>
<%@page import="com.lmpop.trade.ts_custclass.*" %>
<%@page import="com.lmpop.trade.ti_gift.Ti_giftInfo"%>

<%
 
 	request.setCharacterEncoding("utf-8");
 	
    Ti_discountpolicyInfo ti_discountpolicyInfo=new Ti_discountpolicyInfo();
    List list=ti_discountpolicyInfo.getOfferTypesByGoodOffer();
    String[] arrays=new String[]{"购物送礼","满额打折","满量打折","运费优惠","满额赠送","买几送几"};
    Ts_custclassInfo custclassinfo = new Ts_custclassInfo();
	Map classmaps=custclassinfo.getCust_classname();
	Ti_giftInfo giftInfo=new Ti_giftInfo();
   %>     
<html>

    <head>
        <meta http-equiv="x-ua-compatible" content="ie=7" />
        <title>选择优惠类型</title>
        <script type="text/javascript" src="/js/commen.js"></script>
        <link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css"/>
        <script src="js_link.js" type="text/javascript"></script>
    </head>

    <body>
    
		<div style="width:600px;">
			<font color="red">请选择一种优惠</font>
		   <table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
				<tr>
					<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
					<th>优惠类型</th>
					<th>折扣率</th>
			  	    <th>会员级别</th>
					<th>消费额</th>
					<th>数量</th>
					<th>礼品</th>
				</tr>
				<% 
		     int listsize=0;
		     if(list!=null && list.size()>0){
		        listsize =  list.size();   
		        List giftList=null;  
		        for(int i = 0;i < listsize;i++){ 
				        Hashtable gMap =(Hashtable)list.get(i);
				        String discount_id="",spending="",member_level="",number="",gift_ids="",offer_type="", discount="", gift_name="";
		       			 if (gMap.get("discount_id") != null){
							discount_id = gMap.get("discount_id").toString();
						}
						if (gMap.get("spending") != null){
							spending = gMap.get("spending").toString();
						}
						if (gMap.get("member_level") != null){
							member_level = gMap.get("member_level").toString();
						}
						if (gMap.get("number") != null){
							number = gMap.get("number").toString();
						}
						if (gMap.get("gift_ids") != null){
							gift_ids = gMap.get("gift_ids").toString();
						}  
						 if (gMap.get("offer_type") != null){
							offer_type = gMap.get("offer_type").toString();
						}  
						if(gMap.get("discount")!=null){
						   discount = gMap.get("discount").toString();
						}
						giftList=giftInfo.getListByPk(gift_ids);
							if(giftList!=null&&giftList.size()>0){
								gMap=(Hashtable)giftList.get(0);
								gift_name=gMap.get("gift_name").toString();
							}
		   	%>		  
				<tr>
					<td width="5%" align="center">
						<input type="checkbox" name="checkone<%=i%>" id="checkone<%=i%>" value="<%=discount_id%>" />
						<input type="hidden" name="chechGoodsName" id="chechGoodsName<%=i%>" value="<%=offer_type%>" />
					</td>
					<td><%=arrays[Integer.parseInt(offer_type)-1]%></td>
					<td>                <%=discount %>            </td>
				  	<td><%
						if(classmaps!=null&&classmaps.get(member_level)!=null ){%>
							<%=classmaps.get(member_level) %>
						<%}else{
					%>
						无
					<%} %></td>
				  	<td><%=spending%></td>
				  	<td><%=number%></td>
				  	<td><%=gift_name%></td>
				</tr>
				<%
		   			}	  
			  	}
			  %>  
			</table> 
			</div>
			<br/>
			
			
			<div style="text-align:center;">
			<input type="button" class="buttoncss" value="确定" onclick="setOfferTypeToDetail()"/>
      		<input type="hidden" name="listsize" id="listsize" value="<%=listsize%>"/>
      </div> 
    </body>
</html>
